﻿<view:WindowBase x:Class="MVVMFramework.WPFDemo.UserView"
        x:ClassModifier="internal"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:view="clr-namespace:MVVMFramework.View;assembly=MVVMFramework.View" 
        Title="{Binding Title}" Width="350"
        FocusManager.FocusedElement="{Binding ElementName=tbUserName}"
        SizeToContent="Height"
        WindowStartupLocation="CenterScreen">
    <Grid Margin="5">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <TextBlock Text="User Name:" Grid.Column="0" />
        <TextBox Name="tbUserName" Text="{Binding Entity.UserName, NotifyOnValidationError=True}" Grid.Column="1" view:WatermarkService.Watermark="Enter User Name..."/>

        <TextBlock Text="Date of Birth:" Grid.Column="0" Grid.Row="1"/>
        <view:DateTimePicker Value="{Binding Entity.DateOfBirth}" Grid.Column="1" Grid.Row="1" ShowDropDown="False" Width="150" HorizontalAlignment="Left"/>

        <TextBlock Text="Valid From:" Grid.Column="0" Grid.Row="2"/>
        <StackPanel Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
            <view:DateTimePicker Value="{Binding Entity.ValidFrom}"  ShowDropDown="True" 
                             Format="ShortDate" ShowTimePicker="False"
                             ShowButtonSpinner="False" Width="150" HorizontalAlignment="Left"/>

            <view:TimePicker Value="{Binding Entity.ValidFrom}"  ShowDropDown="False"/>
        </StackPanel>

        <view:Expander Grid.Row="3" Grid.ColumnSpan="2" Header="More" Foreground="Gray">
            <TextBlock Text="Here can be some additional information about user" Foreground="Black" Margin="5" TextWrapping="Wrap"/>
        </view:Expander>

        <TextBlock Text="{Binding ValidationMessage}" TextWrapping="Wrap" Grid.Row="4" Grid.ColumnSpan="2" Foreground="Red"/>

        <TextBlock Text="Rate:" Grid.Row="4"/>
        <view:Rating RatingValue="4" Margin="4" Grid.Row="4" Grid.Column="1" Height="25" HorizontalAlignment="Left"/>

        <StackPanel Grid.Row="6" Orientation="Horizontal" HorizontalAlignment="Right" Grid.ColumnSpan="2">
            <Button Content="OK" IsDefault="True" Command="{Binding SaveCommand}"/>
            <Button Content="Cancel" IsCancel="True" Command="{Binding CancelCommand}"/>
        </StackPanel>
    </Grid>
</view:WindowBase>
